E6156 $-$ Topics in SW Engineering: Cloud Computing
Backend-as-a-Service

Lecture 1: Introduction, Overview, Web/REST Applications
(Draft 0.8)

Note: Some code to modify notebook width.

In [1]:
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:80% !important; }</style>"))
display(HTML("<style>.output_result { max-width:80% !important; }</style>"))
display(HTML("<style>.prompt { display:none !important; }</style>"))

Today's Lecture

  1. Lecture overview

  2. Logistics:
    • Course overview and agenda
    • Structure, lectures, meetings
    • Grading, assignments, ...

  3. Overview of concepts we will cover:
    • Will overview today:
      • Cloud: IaaS, SaaS, PaaS, MBaaS, APIaaS, FaaS, ...
      • Containers
      • Microservices
      • APIs: API management/gateways, using APIs (Just the basics today)
      • Content distribution networks (Just the basics)
      • REST
    • In future lectures:
      • Continuous Integration/Continuous Delivery, Agile Development, Infrastructure as code
      • Message-Drive-Architectures, Event-Driven-Architectures
      • Service orchestration, workflow, ...
      • Kubernetes
      • OAuth2, social media integration
      • Multi-tenancy
      • SQL, NoSQL, Graph, ..., cloud databases, data pipelines, ...
      • Service styles/categories
      • Application and systems management
      • Application development best practices
      • Integration with productivity applications (G Suite, AWS WorkDocs)
      • Data synchronization and events (Firebase, AWS AppSync)
      • Security, in general.
    • The lists above are basically reminders for me. There are tons of material I could cover but will not get to.

  4. Today's details:
    • Course project: 1) Overview, 2) Milestone 1
    • REST

Course Overview, Structure and Logistics

Instructor

  • Donald F. Ferguson
    • Ansys, Inc.: Senior Technical Fellow, Chief Software Architect.
    • Adjunct Professor, Dept. of Computer Science.
  • Academic experience
    • Ph.D. in Computer Science, Columbia University, 1989
    • Joined Columbia as full time Professor of Professional Practice, 01-Jan-2018.
    • Transitioned back to Adjunct Professor, 01-Jan-2019.
    • 13 semesters as an adjunct professor teaching
      • E6998: Topics in Computer Science or E6156: Topics in SW Engineering.
        • Cloud Computing
        • Web and Internet Application Development
        • Web Application Servers and Applications
        • Microservices
      • W4111 - Introduction to Databases
    • Professor of Professional Practice in Computer Science, January 2018
      • E1006 - Introduction to Computing for Engineers and Applied Scientists using Python
      • W4111 - Introduction to Databases
      • E6156 - Topics in SW Engineering: Microservices and Cloud Applications
  • Publications
    • Approximately 70 technical publications
    • Authored, co-authored several standards in web applications and web services.
    • Web Services Platform Architecture: SOAP, WSDL, WS-Policy, WS-Addressing, WS-BPEL, WS-Reliable Messaging, and More, ISBN-13: 978-0131488748, 2005, Pearson Education
    • 12 patents
    • Program chair for about 8 international technical conferences
  • Personal and hobbies
    • Two amazing daughters (One is Barnard student. One is a senior in high school)
    • Interested in languages. Speak Spanish reasonably well and trying to learn Arabic.
    • Black Belt in Kenpo Karate
    • Amateur astronomy
    • Road bicycling
    • Officer in the New York Guard


About Me

Objectives

  • We will form small teams and build a simple, realistic microservice/cloud application
    • There will be a common core set of functionality to help you get started, e.g. user registration
    • The teams can choose their project functionality $-$ what application do you want to build
    • Teams have some flexibility on which cloud technology they use based on their interests.
  • Course objectives:
    • Practical experience with modern technology for building solutions
    • Be able to say that you have built a microservice/cloud application delivering APIs, and cite a list of technology used
    • Become a better programmer through experience with patterns and best practices. My experience has been that most students write "crappy code"
    • Prepare you for internships and jobs
    • Have seriously cool stuff to put on your resume and discuss on interviews

Coursework

Concept Model

  • Build a simple multi-tenant cloud application in a small team (4 or 5 people):
  • Regular project status reports, instructor meetings, demos, presentations, ...
  • Sort of like a small startup, only with a bit more formal reviews

Course Format, Grading and Environment

  • Lectures: Friday, 2:10pm to 4:00pm
  • We may periodically cancel lectures and schedule separate team meetings with me to discuss projects, provide feedback and suggestions, etc.
  • Office Hours:
    • Friday: 8:30 AM to 10:00 AM, 1:00 PM to 2:00 PM, 4:00 PM to ?
    • By appointment, as needed, as available. I typically post on Piazza when I will have extra availability.
      I normally have a lot of extra office hours, typically on weekends.
  • Course Material:
    • No textbook
      • Textbooks become out of date in this rapidly changing area.
      • Material would span several books.
    • Lecture notes and code samples on GitHub. Sample code is mostly in Flask/Python and JavaScript/Node.js.. I would like you get experience with both, and perhaps with Go.
    • There will be some programming and example for UI in HTML/CSS/Angular, but this is not the focus of this course. UI/User Experience is a multi-semester course by itself.
    • References to web documents and tutorials.
  • Collaboration environments:
  • Grading:
    • Based on final project, including project presentation. 4-5 person teams.
    • Mandatory interim checkpoints and presentations, approximately every two weeks.
    • Weekly written status reports.
    • Meeting instructor defined project requirements is an "A."

Course Topic Overview (Initial Set)

Cloud Computing

Concepts

"Cloud computing is an information technology (IT) paradigm that enables ubiquitous access to shared pools of configurable system resources and higher-level services that can be rapidly provisioned with minimal management effort, often over the Internet. Cloud computing relies on sharing of resources to achieve coherence and economies of scale, similar to a public utility." (https://en.wikipedia.org/wiki/Cloud_computing)

Cloud Computing
  • NIST Conceptual Model:
    • National Institute of Standards and Technology (NIST) defined a conceptual model for cloud computing.
    • Somewhat date and conceptual, which means the ideas matter but no one directly realizes the architecture.
NIST Cloud Concetual Model
  • NIST Terminology:
    • Infrastructure-as-a-Service: "The capability provided to the consumer is to provision processing, storage, networks, and other fundamental computing resources where the consumer is able to deploy and run arbitrary software, which can include operating systems and applications. The consumer does not manage or control the underlying cloud infrastructure but has control over operating systems, storage, and deployed applications; and possibly limited control of select networking components (e.g., host firewalls)."

    • Platform-as-a-Service: "The capability provided to the consumer is to deploy onto the cloud infrastructure consumer-created or acquired applications created using programming languages, libraries, services, and tools supported by the provider.3 The consumer does not manage or control the underlying cloud infrastructure including network, servers, operating systems, or storage, but has control over the deployed applications and possibly configuration settings for the application-hosting environment."

    • Software-as-a-Service: The capability provided to the consumer is to use the provider’s applications running on a cloud infrastructure. The applications are accessible from various client devices through either a thin client interface, such as a web browser (e.g., web-based email), or a program interface. The consumer does not manage or control the underlying cloud infrastructure including network, servers, operating systems, storage, or even individual application capabilities, with the possible exception of limited userspecific application configuration settings.
Cloud Computing Layers

Some additional concepts:

  • Mobile "backend" as a service (MBaaS): In the mobile "backend" as a service (m) model, also known as backend as a service (BaaS), web app and mobile app developers are provided with a way to link their applications to cloud storage and cloud computing services with application programming interfaces (APIs) exposed to their applications and custom software development kits (SDKs). Services include user management, push notifications, integration with social networking services and more. This is a relatively recent model in cloud computing,[74] with most BaaS startups dating from 2011 or later but trends indicate that these services are gaining significant mainstream traction with enterprise consumers.

  • Serverless computing: Serverless computing is a cloud computing code execution model in which the cloud provider fully manages starting and stopping virtual machines as necessary to serve requests, and requests are billed by an abstract measure of the resources required to satisfy the request, rather than per virtual machine, per hour. Despite the name, it does not actually involve running code without servers. Serverless computing is so named because the business or person that owns the system does not have to purchase, rent or provision servers or virtual machines for the back-end code to run on.

  • Function as a service (FaaS): Function as a service (FaaS) is a service-hosted remote procedure call that leverages serverless computing to enable the deployment of individual functions in the cloud that run in response to events. FaaS is included under the broader term serverless computing, but the terms may also be used interchangeably.

*-As-a-Service (Focus)

  • "*aaS is an acronym for as a service (e.g., X as a service), and refers to something being made available to a customer as a service,[1] always in the context of cloud computing." (https://en.wikipedia.org/wiki/As_a_service)
  • "Mobile backend as a service (MBaaS), also known as "backend as a service",[1][2][3] is a model for providing web app and mobile app developers with a way to link their applications to backend cloud storage and APIs exposed by back end applications while also providing features such as user management, push notifications, and integration with social networking services.[4] These services are provided via the use of custom software development kits (SDKs) and application programming interfaces (APIs). BaaS is a relatively recent development in cloud computing,[5] with most BaaS startups dating from 2011 or later.[6][7][8] Although a fairly nascent industry, trends indicate that these services are gaining mainstream traction with enterprise consumers." (https://en.wikipedia.org/wiki/Mobile_backend_as_a_service)
Service Abbr.
Analytics as a service AnaaS
API as a service AaaS
Artificial intelligence as a service AIaaS
Backend as a service BaaS
Banking as a service
Blockchain as a service
Business process as a service BPaaS
Contact Information as a service CIaaS
Content as a service CaaS
Construction as a service
Container as a service
Crane as a service
Communications Platform as a Service CPaaS
Data as a service DaaS
Desktop as a service
Drone as a service
Database as a service DBaaS
Distribution as a service DaaS
Exposure as a service EaaS
Energy storage as a service ESaaS
Electric vehicle as a service [2] EVaaS
Function as a service FaaS
Farming as a service
Games as a Service GaaS
Hadoop as a Service HaaS
Hardware as a Service
Housing as a Service
Infrastructure as a Service IaaS
Identity as a Service IDaaS
IoT as a Service IoTaaS
IT as a Service ITaaS
Knowledge as a Service KaaS
Logging as a Service LaaS
Management as a Service MaaS
Microgrid as a Service
Mobility as a Service
Monitoring as a Service
Metal as a Service
Mobile backend as a service MBaaS
Machine Learning as a service MLaaS
Network as a service NaaS
Network Defense as a service NDaaS
Payments as a service PaaS
Platform as a service
Push notification as a service
RAN as a service
Recovery as a service RaaS
Recycling as a service
Robot as a service
Search as a service SaaS
Security as a service
Software as a service
Storage as a service
Transportation as a service TaaS
Testing as a service
Unified Communications as a Service UCaaS
  • In addition to UIs, the APIs support other applications, business partners, etc.
image.png
https://www.slideshare.net/SOA_Software/api-frenzy-api-strategy-101
  • Amazon Web Services will be the realization of most technical concepts (e.g. serverless, pub/sub).
  • AWS was the dominant public cloud platform when I started teaching cloud computing, but other vendors have become important.
image.png
https://www.flexera.com/blog/cloud/2019/02/cloud-computing-trends-2019-state-of-the-cloud-survey/
  • Concepts are what is important; you can master any realization once you understand the concepts.

Microservices

  • Definition: "A 'microservice' is a software development technique—a variant of the service-oriented architecture (SOA) architectural style that structures an application as a collection of loosely coupled services. In a microservices architecture, services are fine-grained and the protocols are lightweight. The benefit of decomposing an application into different smaller services is that it improves modularity and makes the application easier to understand, develop, test, and more resilient to architecture erosion. It parallelizes development by enabling small autonomous teams to develop, deploy and scale their respective services independently. It also allows the architecture of an individual service to emerge through continuous refactoring. Microservices-based architectures enable continuous delivery and deployment." (https://en.wikipedia.org/wiki/Microservices)
  • Note: I often cut and paste definitions from Wikipedia. Wikipedia is not normative and is one of many views on any topic. The pages are a good overview and launching point for more details. Plus, if you can use Github for code and solutions, I can cut and paste text.
  • Most of the SW university students develop in their courses are "monoliths." These are not representative of real SW systems "in the field."

Monoliths versus Microservices
  • Most medium to large SW systems are componentized, and microservices are increasingly the most common approach to modular, componentized systems.
  • Microservice Characteristics:
    • Componentization via Services
    • Organized around Business Capabilities
    • Products not Projects
    • Smart endpoints and dumb pipes
    • Decentralized Governance
    • Decentralized Data Management
    • Infrastructure Automation
    • Design for failure
    • Evolutionary Design

Caching and Content Delivery Networks

"A content delivery network or content distribution network (CDN) is a geographically distributed network of proxy servers and their data centers. The goal is to provide high availability and high performance by distributing the service spatially relative to end-users. CDNs serve a large portion of the Internet content today, including web objects (text, graphics and scripts), downloadable objects (media files, software, documents), applications (e-commerce, portals), live streaming media, on-demand streaming media, and social media sites." (https://en.wikipedia.org/wiki/Content_delivery_network)

Content Delivery Network
  • Origin Server: Contains original/current versions of files for URLs.
  • CDN Node: Holds a copy of the original/current version of files for URLs.
  • Clients:
    • Logically request URL from the "origin web site."
    • Nearby CDN node servers request.
Amazon Cloud Front

We will use Amazon CloudFront. This provides several capabilities:

  1. Content delivery network, which is important in real solutions but not something we really need.

  2. Single site image:
    • Our solution will have several microservice endpoints.
    • Each endpoint has a distinct IP address and DNS name.
    • We want to present the image of a single endpoint, e.g. "e6156.dff-cu.org," instead of several semi-random IP addresses and DNS names.

  3. Single origin for handling HTTPS and certificates for security.

APIs: API Management/Gateways, using APIs

Concept

"The “API Economy” is much more than just a buzz phrase. It’s become a key enabler of digital transformation and agile businesses. In a recent report, McKinsey explains, “As the connective tissue linking ecosystems of technologies and organizations, APIs allow businesses to monetize data, forge profitable partnerships, and open new pathways for innovation and growth. ... ...

Businesses of all shapes and sizes are reaping benefit from APIs. According to a Harvard Business Review article, Salesforce has generated half of its revenue to through APIs, while Expedia.com has generated a whopping impressive 90% in recent years. APIs have become so essential to businesses that 85% consider web APIs and API-based integration fundamental to their business strategy and continued success." Forbes, 2019. (https://www.forbes.com/sites/falonfatemi/2019/04/30/3-keys-to-a-successful-api-strategy/)



(Old) Cloud Companies and APIs



Programmable Web Growth





API Management/Gateway



  • API Management capabilities/functions (from InfoQ]:
    • API Discovery (Catalog, Search and Provisioning)
    • API Security (SSL, PKI, threat protection, schema validation, encryption, signatures, etc)
    • API Identity (AuthN & AuthZ, API key, OAuth, SAML, LDAP, proprietary IAM, multifactor, token translation & management)
    • API Orchestration (adaptation of multiple services, workflow operations, branching policies, etc.)
    • Uniform interface/proxy to multiple backend messaging protocols (JMS, RMI etc)
    • Developer and App OnBoarding (Client ID/App Key generation, Interactive API console)
    • Community Management (Blogs, Forums, Social features etc)
    • API Lifecycle governance (Versioning)
    • Traffic Mediation (SOAP to REST mediation, data format transformation, legacy application integration)
    • Traffic Shaping( Rate limitation, Caching etc)
    • Analytics & Traffic Monitoring
    • API metering, Billing and Monetization
    • Data Protection(Data encryption, Data masking etc for PCI/PII compliance)
    • Mobile Optimization (Pagination, Compression, JSON etc)
    • Deployment Flexibility (on-premise, cloud, managed service, SaaS, hybrid)
    • Operational Integration (System Monitoring, Clustering, Scalability, Migration)
    • Mobile Integration (support for push notifications, geolocation, streaming protocols)
    • Cloud Integration (SSO to SaaS providers, IaaS integration, SaaS data connectors, hybrid cloud support)
  • There are two aspects to using and consuming web APIs.



AWS API Gateway



  • We will (try) to use a couple of application/business web APIs as part of our sample application:

Virtualization and Containers

Virtualization

"In computing, a virtual machine (VM) is an emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardware, software, or a combination." (https://en.wikipedia.org/wiki/Virtual_machine)

image.png
https://nickjanetakis.com/blog/comparing-virtual-machines-vs-docker-containers
  • We use "machines" for isolation. Applications cannot interfere (easily) if they are on two different machines.
    • Resource contention
    • SW incompatibility
    • Security
    • etc.
  • I have a Mac and for some inexplicable reason, I also want a Windows machine.
  • I can but a new laptop, or
    • Buy and install VMware Fusion
    • Get a Windows license
    • Start VMware Fusion
    • Use File->New-> ...

image.png

  • "Finish" basically powers on a "computer" and installs from the virtual DVD/CD (actually a .iso) file. The operating system installs and starts.
  • On my computer:
    • mac OS Catalina is the host operating system and runs applications
    • Two of those applications are:
      1. VMware Fusion
      2. VirtualBox
    • I run a Windows 10 Pro using VMware Fusion
    • An Ubuntu image on VirtualBox
image.png
Some Consoles and Applications
image.png
HW, Virtual HW, Software
image.png
Virtual Machine Management

Containers

  • "OS-level virtualization refers to an operating system paradigm in which the kernel allows the existence of multiple isolated user space instances. Such instances, called containers (Solaris, Docker), Zones (Solaris), virtual private servers (OpenVZ), partitions, virtual environments (VEs), virtual kernel (DragonFly BSD), or jails (FreeBSD jail or chroot jail),[1] may look like real computers from the point of view of programs running in them. A computer program running on an ordinary operating system can see all resources (connected devices, files and folders, network shares, CPU power, quantifiable hardware capabilities) of that computer. However, programs running inside of a container can only see the container's contents and devices assigned to the container." (https://en.wikipedia.org/wiki/OS-level_virtualization)
image.png
Docker Containers
image.png
Docker System
  • Let's make things more complicated on my computer.
  • I am going to "pull" and start a Debian runtime environment.
image.png
Pull and Start Debian using Docker
image.png
1 physical computer, 2 VMs and a Docker Container

Discussion

  • Why would we do this kind of crazy stuff?
    1. It's cool!
    2. For the same reason we climb Mt. Everest, "Because we can!"
    3. Isolation/Encapsulation:
      • Modern computers can simultaneous run 100s (1000s) of applications.
      • The applications can "interfere" with each other:
        • Competition for CPU, memory, disk space, ...
        • Incompatible or conflicting prerequisite SW. Installing the required SW for application "X" might mess up the already installed required SW for application "Y."
      • Isolation improves security. A bug or virus in environment "A" cannot (is less likely) to compromise the security of applications running in other containers/VMs.
  • Why don't we just "buy" more computers and use physical isolation?
    • Efficiency: Putting multiple containers on a physical system improves resource utilization.
    • Agility:
      • I can just "make" a new computer for my application.
      • I do not need to
        • Fill out a purchase order.
        • Wait for deliver.
        • Set up networking, HW, ...
        • etc.
  • This introduces the concept of "infrastructure as code."Infrastructure as code (IaC) is the process of managing and provisioning computer data centers through machine-readable definition files, rather than physical hardware configuration or interactive configuration tools." (https://en.wikipedia.org/wiki/Infrastructure_as_code)
    • I have a complex SW configuration supporting my application.
    • If I have to modify the supporting HW or SW, I can just "write code."
    • I keep the infrastructure definition in synch with the application, including Git, etc.
  • Want a new "computer" in the "cloud?"

Before

image.png

In [4]:
import boto3
ec2 = boto3.resource('ec2')
In [5]:
# create a new EC2 instance
instances = ec2.create_instances(
     ImageId='ami-0323c3dd2da7fb37d',
     MinCount=1,
     MaxCount=1,
     InstanceType='t2.micro'
 )

After

image.png

Running

image.png

  • I can create, modify, start and stop isolated computing environments as part of my normal SW development lifecycle.
  • I did not configure networking, firewalls, etc. for the machine I just created. So, we cannot connect to it but we will learn how do do that later.
  • This was a virtual machine example. I could have also done a container example.

Platform-as-a-Service and Elastic Beanstalk

Platform-as-a-Service Concept

IaaS, PaaS, SaaS
  • We discussed the concept briefly above.
  • Infrastructure-as-a-Service (IaaS) virtualizes the HW. You still have to manage the VM, and install, manage, config, ... the enablement software you use for your application. Examples include:
    • Middleware, e.g. database management products.
    • Languages and frameworks, e.g. Python, Flask, ...
  • PaaS has the HW and SW environment pre-built, pre-configured and maintained. You focus on "dropping" your application into the PaaS "container." One of the early terms for the application was a "droplet."
  • Ideally, the approach is more efficient and agile. You focus on the application, and not commodity infrastructure tasks. The price you pay is flexibility and control.

Elastic Beanstalk - Concept and Walkthrough

Beanstalk Concept
  • Deploying the application
    • There are a lot of ways to get the zip file into the Elastic Beanstalk environment.
      • AWS command line tools.
      • AWS CodeCommit pipeline.
      • IDE plugins
    • I do it manually for the simple example and configuration.
    • Compress on Mac creates extra stuff and you have to run zip -d archive.zip __MACOSX/\* to remove junk before upload.
  • Database:
    • There are several approaches to creating and configuring the database and data.
    • The simplest is to create a separate RDS instance, configure schema, etc. and take a snapshot.
    • Choose creating an instance inside the Beanstalk application from the snapshot.
  • Deployment and configuration can be a little tricky. More real scenarios
    • Work out all of the kinks and conditions.
    • Write scripts and jobs to automate deployment.
  • But again, our environment is simple and we will just manually fix problems.
  • We will also do some extra stuff to make the deployed application look like it comes from a real company.

Simple Demo

  • I built a "simple" Flask application using PyCharm
image.png
A "Simple Flask" Application
  • And I can run the application locally ...
image.png
Local Execution on localhost:8000
  • The application delivers static content, e.g. HTML, CSS, ...
In [6]:
import json
import requests
In [14]:
res = requests.get("http://localhost:8000/api/health")
d = res.json()
d
Out[14]:
{'status': 'healthy',
 'time': '2020-05-24 14:23:13.435959',
 'platform': 'Darwin',
 'release': '19.4.0',
 'note': "For some reason, macOS is called 'Darwin'",
 'hostname': 'MacBook-Pro-2.local',
 'IPAddr': '127.0.0.1'}
  • I created an Elastic Beanstalk environment and deployed the application in the AWS cloud.
image.png
Cloud Execution: http://e6156f2020flask-env.eba-p7hph49b.us-east-1.elasticbeanstalk.com/
In [15]:
res = requests.get("http://e6156f2020flask-env.eba-p7hph49b.us-east-1.elasticbeanstalk.com/api/health")
d = res.json()
d
Out[15]:
{'status': 'healthy',
 'time': '2020-05-24 18:26:43.059505',
 'platform': 'Linux',
 'release': '4.14.173-137.229.amzn2.x86_64',
 'hostname': 'ip-172-31-17-126.ec2.internal',
 'IPAddr': '172.31.17.126'}

Some Comments

  • Note to Instructor: Demo the environment.

  • There are two relatively serious issues.

    1. The URL is "weird."
      • The URL is http://customerinfo2-env.yhm9mxm39c.us-east-1.elasticbeanstalk.com/e6156/
      • I probably want something more like my-cool-class.net
    2. The URL is HTTP, not HTTPS and thus NOT SECURE. This will become a problem when we start logging on, manipulating data, etc.
UI with HTTPS and Domain
  • A final issue is that we are serving static content out of the Flask, which is not a best practice.
  • We will move to a more sophisticated configuration.
Beanstalk Deployment
  • We will not worry about high/continuous availability or elastic scaling/load balancing.
  • We will add:
    • S3 for static content delivery.
    • Amazon Route 53 for custom domain.
    • CloudFront for providing a single site image to all of the things we will build.
    • CloudFront and AWS Certificate Manager for HTTPs.
  • For now, just focus on BeanStalk.
  • But do not worry about this for now, just focus on getting your application working locally and then on Elastic Beanstalk.

Microservice and Web Application

Web Applications

image.png
Web Application
  • "An application server is a server that hosts applications.

    Application server frameworks are software frameworks for building application servers. An application server framework provides both facilities to create web applications and a server environment to run them.

    An application server framework contains a comprehensive service layer model. It includes a set of components accessible to the software developer through a standard API defined for the platform itself. For Web applications, these components usually run in the same environment as their web server(s), and their main job is to support the construction of dynamic pages. However, many application servers do more than generate web pages: they implement services such as clustering, fail-over, and load-balancing, so developers can focus on implementing the business logic." (https://en.wikipedia.org/wiki/Application_server)
  • (Almost) All of the programs you have written up until now have had the form:
    • Your code is "the main program."
    • It receives command line arguments.
    • Performs functions and calls libraries.
    • Prints out an answer.
image.png
Simple Main Program
  • In an application server:
    • The application server code (class) is the main program.
    • The program listens for messages (from the network).
    • Converts the network message into a normal language runtime call.
    • Calls your function.
    • Converts the functions return into a network message.
    • Sends a response.
image.png
Application Server and Application
  • In our simple example,
    • If the URL is of the form "/static/...", the application server just returns the file.
    • If the URL matches a path template, it calls the corresponding function.
image.png
Application and Static Content
  • Path and a function.
image.png
Simple Example of Application Logic and Path

UI and Applications

image.png
User Interface and Application
  • User Interface Design/User Experience, building good web front-ends and building good mobile/device applications are complex topics that require their own courses and projects.
  • For explanation and understanding, we will focus on browser-based web UIs.
  • A web browser user interface contains the following artifact/code types:
    • HTML pages that provide the text and overall structure for the UI.
    • Cascading Style Sheets that customize the content, e.g. colors, borders, ...
    • Media: images, videos, ...
    • JavaScript code.
  • The UI applications follow a pattern that frameworks and libraries enable.
image.png
Model-View-Controller (MVC) and Model-View-ViewModel (MVVM)
  • In both designs, the Model represents a connection and cached version of application function and data provided by a microservice.
image.png
Model and Microservice

Classical Structure and Microservices Architecture

image.png
Classical Application Structure
  • Everything was in one applications and project.
  • The microservices approach decouples into independent services. Each service
    • Evolves independently to simplify large scale development.
    • Honors previous versions of APIs to avoid requiring changes to other services.
    • Applies technology that is optimal for the specific task or service.
      • Polyglot programming
      • Polyglot persistence
      • etc.
image.png
Microservice Architecture

Course Project

Overview

Milestone 1 (18-Sep-2020)

  1. Develop and execute three "hello world" microservices
    1. Services:
      1. CustomerInfo
      2. AccountManagement
      3. OrderManagement
    2. One service must by in Python/Flask. One service must be in NodelJS.
    3. Each microservice must:
      • Return a "Hello World" HTML page describing the service.
      • An endpoint/path URL /service_info that just returns some text.
        We will convert to a REST method.
  1. You may develop and test locally on your laptops.
  1. Each microservice will be its own Github repository that you share.
  1. Signup for an AWS free-tier account for your team and add your team members.
  1. Your deliverable is a short, status report document. I will provide a template.
  1. Ideally, you will do a demo (or attend a demo) with the TAs and me.
  1. In milestone #2, we will deploy onto the cloud:
    • Static content will go onto S3.
    • One service will deploy on each of:
      • Elastic Beanstalk
      • Elastic Container Service
      • Elastic Compute Service
In [ ]: